﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>方向条件-开发者参数</title>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
    <script src="../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../Comm/Gener.js" type="text/javascript"></script>
    <script src="../Admin.js" type="text/javascript"></script>


    <link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <base target="_self" />
    <script type="text/javascript">

        function Esc() {
            if (event.keyCode == 27)
                window.close();
            return true;
        }
        var condOrAnd = GetQueryString("CondOrAnd");
        //初始化页面函数.....
        $(function () {

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("CondByPara_Init");

            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red>加载失败:<br>" + data + "</font> .");
                return;
            }

            if (data.indexOf('url@') == 0) {
                var url = data.replace('url@', '');
                window.location.href = url;
                return;
            }

            //转json.
            data = JSON.parse(data);

            var docs = data.OperatorValue;
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");
            docs = docs.replace("~", "'");

            document.getElementById("TB_Docs").value = docs;
            document.getElementById("TB_Note").value = data.Note;

        });

        //执行保存..
        function Save() {

            var sqlVal = document.getElementById("TB_Docs").value;
            var note = document.getElementById("TB_Note").value;


            if (sqlVal == "") {
                alert('请输入参数.');
                return;
            }
            if (note == "") {
                alert('请输入备注说明.');
                return;
            }

            if (sqlVal.indexOf(' ') == -1) {
                alert("表达式：" + sqlVal + " 不符合要求，必须中间用空格。比如：1 = 1 ，请参考帮助文件。");
                return;
            }

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
            handler.AddUrlData();
            handler.AddFormData();
            handler.AddPara("CondOrAnd", GetQueryString("CondOrAnd"))
            var data = handler.DoMethodReturnString("CondByPara_Save");

            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }

            if (data.indexOf('url@') == 0) {
                var url = data.replace('url@', '');
                window.location.href = url;
                return;
            }

            alert(data);

            //$("#Msg").html("<font color=green>" + data + "</font>");

        }

        //执行删除..
        function Delete() {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
            handler.AddUrlData();
            var data = handler.DoMethodReturnString("CondByPara_Delete");

            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                return;
            }

            if (data.indexOf('url@') == 0) {
                var url = data.replace('url@', '');
                window.location.href = url;
                return;
            }

            alert(data);
            document.getElementById("TB_Docs").value = "";
            document.getElementById("TB_Note").value = "";
        }

        //装载 CondByPara 模版.
        function LoadTemplate() {

            //打开方向条件.
            var url = "../SettingTemplate.htm?TemplateType=CondByPara&CondType=2&m=" + Math.random();
            WinOpen(url, 'ss');
        }
         //返回.
        function Back() {
            var url = window.location.href;
            if (condOrAnd==null)
                url = url.replace('CondByPara.htm', 'List.htm');
            else
                url = url.replace('CondByPara.htm', '../Cond2020/DirList.htm');
            window.location.href = url;
        }

        /**/</script>
</head>
<body onkeypress="Esc();">
    <form id="cc">
        <div style="right:30px; position:absolute; z-index:100; ">
            <fieldset style="border: 0px;">
                <input type="button" value="加载模版" onclick="LoadTemplate()" />
                <input type="button" value="保存" onclick="Save()" />
                <input type="button" value="删除" onclick="Delete()" />
                <input type="button" onclick="Back()" value="返回" id="Button2" />
            </fieldset>
        </div>
        <table style="position:relative;top:10px; margin: 8px; width:100%">
            <caption>
                <img style="margin-bottom:8px;" align="middle" src='../../Img/Event.png' /> 方向条件-开发者参数
            </caption>
            <tr>
                <td style="width: 20%;">
                    请输入参数
                </td>
                <td>
                    <textarea rows="1" cols="150" id="TB_Docs" name="TB_Docs" style="width: 95%;"> </textarea>
                </td>
            </tr>
            <tr>
                <td style="width: 20%;">
                    备注(不为空):
                    <br />
                </td>
                <td>
                    <input type="text" value="" id="TB_Note" name="TB_Note" style="width: 95%;" />
                </td>
            </tr>
        </table>

        <div style="text-align: left">
            <h4>
                &nbsp; &nbsp; &nbsp; &nbsp;帮助
            </h4>
            <ul>
                <li>表达式格式：参数+空格+操作符+空格+值，仅支持一个表达式。格式如下：</li>
                <li>Emp = zhangsan</li>
                <li>JinE = 30</li>
                <li>JinE >= 30</li>
                <li>JinE > 30</li>
                <li>Way = '1'</li>
                <li>Way != '1'</li>
                <li>Name LIKE %li%</li>
                <li>如果要设置为恒等：1 = 1 设置为恒等，条件始终成立。</li>
            </ul>
            <fieldset>
                <legend>发送Demo</legend>

                <ul>
                    <li> BP.WF.Dev2Interface.Port_Login("zhangsan"); //登录. </li>

                    <li>Int64 workid = BP.WF.Dev2Interface.Node_CreateBlankWork("001");//创建WorkID.
                    </li>
                    <li>
                        //组织参数, 对方的方向条件是按照参数来设定的.
                    </li>
                    <li>
                        Hashtable ht = new Hashtable();
                    </li>
                    <li>

                        ht.Add("QingJiaTianshu", 10);
                    </li>

                    <li>
                        //执行发送.
                    </li>

                    <li>
                        BP.WF.Dev2Interface.Node_SendWork("001", workid, ht);
                    </li>
                </ul>


            </fieldset>
        </div>
    </form>
    <center>
        <div id="Msg" />
    </center>
</body>
</html>
